#include "pch.h"
#include <iostream>
#include <string>

using namespace std;
class Doctors;

class basic
{
public:
	basic() {}
	virtual void Print() = 0;
};

class diagnose
{
private:
	string treatmentdetails, illnessdetails;
public:
	void changeillnessdetails(string a) { illnessdetails = a; }
	void changetreatmentdetails(string a) { treatmentdetails = a; }
	string gettreatmentdetails() { return treatmentdetails; }
	string getillnessdetails() { return illnessdetails; }
};
class Patients :public basic
{
private:
	string no, name, gender, illnessdetails, treatmentdetails, Diagnose;
	int age;
public:
	Patients(string a, string b) :gender(a), illnessdetails(b) { }
	void Register(string, string, int, string, Doctors& e);
	string getillnessdetails() { return illnessdetails; }
	void Seeadoctor(Doctors&);
	void changeDiagnose(string a) { Diagnose = a; }
	void Print() { cout << "患者编号:" << no << "\t" << "患者姓名:" << name << "\t" << "患者年龄:" << age << "\t" << "患者性别:" << gender << "\t" << "病情详述:" << illnessdetails << "\t" << "诊断:" << Diagnose << "\t" << "治疗方案详述:" << treatmentdetails << endl; }
};

class Doctors :public basic
{
private:
	string no, name, gender, department, professionaltitle;
	int age;
	diagnose diagnosisdetail;
public:
	Doctors(string a, string b, int c, string d, string e) :no(a), name(b), age(c), gender(d), professionaltitle(e) { }
	void OnDuty() { cout << "今日工作\n" << endl; }
	void changedepartment(string a) { department = a; }
	string Diagnose(Patients*);
	void Print() { cout << "医生编号:" << no << "\t" << "医生姓名:" << name << "\t" << "医生年龄:" << age << "\t" << "医生性别:" << gender << "\t" << "医生部门:" << department << "\t" << "专业职称:" << professionaltitle << "\t" << "病情叙述:" << diagnosisdetail.getillnessdetails() << "\t相应治疗方法:" << diagnosisdetail.gettreatmentdetails() << endl; }
};

void Patients::Register(string a, string b, int c, string d, Doctors& e)
{
	no = a;
	name = b;
	age = c;
	e.changedepartment(d);
}

string Doctors::Diagnose(Patients* a)
{
	diagnosisdetail.changeillnessdetails(a->getillnessdetails());
	a->changeDiagnose("骨折");
	diagnosisdetail.changetreatmentdetails("住院观察");
	return diagnosisdetail.gettreatmentdetails();
}

void Patients::Seeadoctor(Doctors& a)
{
	treatmentdetails = a.Diagnose(this);
}

int main()
{
	Patients p("男", "手臂无知觉，无法操纵并且疼痛");
	Doctors q("0001", "小张", 40, "男", "主任");
	p.Register("0001", "小明", 18, "骨科", q);
	p.Seeadoctor(q);
	basic *s;
	s = &p;
	s->Print();
	q.OnDuty();
	s = &q;
	s->Print();
	return 0;
}